package com.zhiliao.observer.demo2;

import java.util.Vector;

/**
 * @author zouxf Department:3cs
 * @date 2023/6/5 18:10
 * @description
 * @see
 */
public abstract class Subject {
    private Vector<ObserverV1> observers = new Vector<>();

    public Vector<ObserverV1> getObservers() {
        return observers;
    }

    public void addObservers(ObserverV1 observer) {
        observers.add(observer);
    }

    protected void notifyObservers(){
        for (ObserverV1 observer : observers) {
            observer.update();
        }
    }
    protected abstract void doSomething();
}
